<?php

namespace Query;

use core\controller\baseController;
use Query\Logic\QueryLogic;
use common\Factory\Factory;

class QueryController extends baseController {
    
    function __construct() {
        $redis = Factory::getServer('Redis');
        $redis && $redis->hIncrBy('ad_query_pv', date('Ymd', time()), 1);
    }
    
    public function idfa() {
        $_POST['appid']='843148930';
        $jsonData = array('success' => false, 'message' => 'select params empty');
        if(isset($_POST['idfa'])) {
            Factory::getServer('MqWriteLog')->connect();
            $queryLogic = new QueryLogic();
            $redis = Factory::getServer('Redis');
            $jsonData = $redis ? $queryLogic->queryIdfaToRedis($_POST, $redis) : $queryLogic->queryIdfa($_POST);
            Factory::getServer('MqWriteLog')->disConnect();
        }
        
        return $this->jsonReturn($jsonData);
    }
}